#ifndef     __MUX_H
#define     __MUX_H

#include "../utils/object.h"
#include "../utils/nocopyable.h"
#include "../rtos/mutex.h"
#include "../utils/bit_ctrl.h"

namespace driver {

class Mux : private utils::NoCopyable {

public: 
    inline bool is_nozzle_top() {
        return utils::is_clr_bit<0>(read());
    }

    inline bool is_door_front() {
        return utils::is_clr_bit<2>(read());
    }

    inline bool is_door_back() {
        return utils::is_clr_bit<3>(read());
    }

    inline bool is_bowl_near() {
        return utils::is_clr_bit<4>(read());
    }


    Mux();

    uint8_t status();

private:
    uint8_t read();

    rtos::Mutex m_mutex;
};

inline utils::Object<Mux> mux;

}

#endif
